<?php
	$this->load->helper('url');
	$this->load->helper('form');
?>

<html>
<head>
    	<title>ICS SAIS</title>
      <link href="<?=base_url()?>style/design.css" rel="stylesheet" type="text/css" />   
<link rel="stylesheet" href="<?=base_url();?>js/jquery-ui.css" />
<script src="<?=base_url();?>js/jquery-1.9.1.js"></script>
  <script src="<?=base_url();?>js/jquery-ui.js"></script>
 

<script type="text/javascript">
	 var RecaptchaOptions = { theme : 'white' };
	
	function form_type_display() {
		if (document.getElementById('type').value == 'student') {
			var className = 'student_form';
		} else if(document.getElementById('type').value == 'faculty'){
			var className = 'faculty_form';
		} else if(document.getElementById('type').value == 'encoder'){
			var className = 'encoder_form'
		}
		
		<!--get elements by class-->
		<!--http://stackoverflow.com/questions/3808808/how-to-get-element-by-class-in-javascript-->
		var elems = document.getElementsByTagName('*'), i;
		for (i in elems) {
			if((' ' + elems[i].className + ' ').indexOf(' ' + className + ' ')
					> -1) {
				elems[i].style.display = 'table-row';
			}
		}
	}
	
	function disable_all_forms(){
		var elems = document.getElementsByTagName('*'), i;
		var form_names = new Array();
		form_names[0] = 'student_form';
		form_names[1] = 'faculty_form';
		form_names[2] = 'encoder_form';
		for (h in form_names){
			for (i in elems) {
				if((' ' + elems[i].className + ' ').indexOf(' ' + form_names[h] + ' ')
						> -1) {
					elems[i].style.display = 'none';
				}
			}
		}
	}
</script>   

<script>
/*Change password jQuery*/
	/*Source:
		http://jqueryui.com/dialog/#modal-form
	*/
 $(function() {
    var name = $( "#name" ),
      email = $( "#email" ),
      password = $( "#password" ),
      allFields = $( [] ).add( name ).add( email ).add( password ),
      tips = $( ".validateTips" );
	  

    function updateTips( t ) {
      tips
        .text( t )
        .addClass( "ui-state-highlight" );
      setTimeout(function() {
        tips.removeClass( "ui-state-highlight", 1500 );
      }, 500 );
    }
 
    $( "#dialog-form" ).dialog({
      autoOpen: false,
      height: 250,
      width: 400,
      modal: true,
      buttons: {
        "Change Password": function() {
            //submit form to database
			$("#form_changepassword").submit();
            $( this ).dialog( "close" );
        },
        Cancel: function() {
          $( this ).dialog( "close" );
        }
      },
      close: function() {
        allFields.val( "" ).removeClass( "ui-state-error" );
      }
    });
 
    $( "#change_pw" )
      .click(function() {
        $( "#dialog-form" ).dialog( "open" );
      });
  });
/*Change password jQuery*/
	

</script>        

</head>
    
<body>
   	<div id="cont">
        	<div id="header_slim">
            	<div id="header_main">
                	<div id="mhleft">
                    </div>
                    
                    <div id="mhcenter">
                    		<img src="<?=base_url()?>style/ics_logo_blue.png" id="logo"/>
                      <div id="label_sais">
                        	<div id="border_label">	</div>
                        <div id="label"><p>Students'Academic
Information System</p></div>
                      </div>
                  </div>
                    
                    <div id="mhright">
                    </div>
                </div>
   
                <div id="bottomhead">
                	<div id="bhleft_slim">
                    </div>
                    <div id="menu_bar_slim">
                    	<!--menu -->
						<?php
							$this->load->helper('url');
						?>
						<div class="header_link">
							<h>Logged in as: <?=$this->session->userdata('user');?></h>
						</div>
                        <div class="header_link">
                        	<?php echo anchor('home/instructorInfo','<h>Basic Info</h>'); ?>
                        </div>
                        <ul id="nav">
                            <li>
                                <div class="header_link">
                                  <a><h>Advisees</h></a>
                                </div>
                                <ul>
                                  <div id="drop_down">
                                    <li><?php echo anchor('home/viewStudents/reg','<h>Registration Advisees</h>'); ?>
                                    <li><?php echo anchor('home/viewStudents/sp','<h>SP Advisees</h>'); ?>
                                  </div>
                                </ul>  
                            </li>
                        </ul>
                         <ul id="nav">
                            <li>
                                <div class="header_link">
                                  <a><h>Students</h></a>
                                </div>
                                <ul>
                                  <div id="drop_down">
                                    <li><?php echo anchor('home/viewSubjects/list','<h>Prerequisite</h>'); ?>
                                    <li><?php echo anchor('home/viewSubjects/previous','<h>Previous Students</h>'); ?>
                                    <li><?php echo anchor('home/viewSubjects/studentList','<h>Student List</h>'); ?>
                                  </div>
                                </ul>  
                            </li>
                        </ul>
                        <div class="header_link">
                            <?php echo anchor('home/viewInstructorSchedule','<h>Schedule</h>'); ?>
                        </div>
                        <div class="header_link">
                         <?php echo anchor('home/logout', '<h>Log out</h>');?>
                        </div>                        
                    </div>
                </div>
            </div>
            
      <div id="body_user">
      	<div id="body_border_user">	<!--light blue border-->
        </div>
        <div id="main_body">
            
            <?php 
         //   echo '<table border = 1>';
            foreach($instructor as $row){
              echo '<tr><td>'.$row->School_Year.'</td>';
              echo '<td>'.$row->Semester.'</td>';
              echo '<td>'.$row->Course_Code.'</td></tr><br />';
            
          //  echo ' </table>';
          }
            echo form_open('home/subjectSearchAcadYearCourse');
            echo '<input type="hidden" value='.$row->School_Year.' name= "sy" />';
            echo '<input type="hidden" value='.$row->Semester.' name= "sem" />';
            echo '<br/>Search Course: <input type="text" name="searchAcadYearCourse" autofocus="autofocus" />';
            echo '<input type="submit" value="Search">';
            ?>
            <?php echo form_close(); //validation ?>
            <?php  ?>
                     
        </div>
      </div>
      </div>
	</div>
</body>